package com.googlecode.maratische.google.testBrowser;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.JToolBar;
import javax.swing.text.html.HTMLDocument;

public class Error2  extends JFrame {

	private JEditorPane textPane;

	public Error2() {
		this.setSize(800, 700);
		setTitle("Error2");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		this.setLayout(new BorderLayout());

		JToolBar toolBar = new JToolBar();
		Box boxToolBar = Box.createHorizontalBox();
		JButton btnStart = new JButton("Start from web");
		btnStart.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					textPane.setPage(new URL("http://yandex.ru"));
				} catch (MalformedURLException e1) {
					e1.printStackTrace();
				} catch (IOException e1) {
					e1.printStackTrace();
				}
			}
		});
		boxToolBar.add(btnStart);
		boxToolBar.add(Box.createHorizontalStrut(10));
		boxToolBar.add(Box.createHorizontalGlue());

		toolBar.add(boxToolBar);
		
		this.add(toolBar, BorderLayout.NORTH);
		
		textPane = new JEditorPane();

//		HTMLDocument document = new HTMLDocument();
//		textPane.setStyledDocument(document);
        textPane.setEditable(false);
		this.add(new JScrollPane(textPane), BorderLayout.CENTER);
	}

	public static void main(String[] args) {
		try {
//	        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//	        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
//	        UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");

	    } catch (Exception unused) {
	    }
		Error2 errorFrame = new Error2();

		errorFrame.setVisible(true);
	}

}
